\chapter{Modem Host Architecture}
DSP, FPGA and Host stack are the software/hardware components of the ARL modem.
The modem stack is based on the Java Agent Development Framework
(JADE)\cite{jadedocu} and motivated by the UNA specifications \cite{una}.This
chapter includes details about the high level architecture of modem and linux
host. An introduction about JADE framework and the concepts involved in
FAPI Agents is also provided.
The command interface and the protocol design for Transport layer is also
described.
\section{High level Architecture}
\begin{figure}[h!]
\centering  
   \includegraphics[scale=0.4]{./img/modemarch.png}
   \caption{ARL UNET Architecture source:\cite{modemppt}}
   \label{modem_arch} 
    
\end{figure}
The dry-end of modem has 3 components mainly; FPGA, DSP and Linux Host. In
Figure~\ref{modem_arch} green blocks indicate the modules implemented on FPGA,
grey modules are implemented on DSP and yellow modules are implemented on linux host.
\subsubsection{FPGA}
Field-programmable gate array (FPGA) software architecture follows a modular
design and acts as a link between DSP and wet-end.
It contains timers, correlators and up/down-shift convertors. Timer events also
provide services for ranging calculation in the network stack. Correlators are
responsible for packet/preamble detection and up/down-shift convertors. It
provides baseband and passband interconversion too.
\subsubsection{DSP}
Digital signal processor (DSP) contains modules for coding and modulation. Golay
and Convolutional coding schemes are implemented. One or both schemes can be
activated by using different bitmasks. Orthogonal frequency-division
multiplexing (OFDM) modulation is also implemented in DSP. 
It also acts as middle-ware between Linux host and FPGA.
\subsubsection{Linux Host} 
 Each layer in ARL modem host stack is implemented as independent JADE agent in
 a linux host computer and these communicate with each other using FAPI
 messages.
 The next section of this chapter explains the JADE framework briefly.
 ARL UNET-2 modem contains PHY,LINK and Ranging agents in network stack.
 
A command line interface is implemented as a separate FAPI agent which contains
 command handlers for each layer in stack. It also provides a AT command
 interface for any user application.



\section{Jade Framework}

JADE (Java Agent Development Framework) \cite{jadedocu} framework is implemented
in Java language. 
It helps in easy implementation of multi-agent systems 
through a middle-ware that claims to comply with the Foundation of Intelligent
Physical Agents (FIPA) specifications.
The agent platform can be distributed across
machines without even having same OS and the configuration. It can be
controlled via a remote GUI. JADE is a distributed Agent platform, agents are implemented as
Java threads and live within agent-containers which provides the runtime support for execution.
 Each loaded agent corresponds to single thread and all executions or tasks
 inside the agent are executed using cooperative multitasking.
The communication architecture provides flexible and efficient messaging, where
JADE creates and manages a queue of incoming ACL messages, private to each agent. 
Agents can access their queue via a combination of several modes: 
 blocking, polling, timeout and based on pattern matching. The complete
  FIPA communication model has been implemented and 
  its components have been clearly distinct and fully integrated.
 
 JADE is
 distributed in Open Source under the LGPL License.
 Further details and documentation can be found at \cite{jadedocu}. 
 \begin{figure}[h!]
   \includegraphics[scale=0.4]{./img/jade.png}
    \caption{FIPA Agent Platform
 source:\cite{jadedocu}}   
 \label{jade}
\end{figure}
A high level overview of the FIPA agent platform is as represented in
Figure~\ref{jade}.

\section{Transport-ARQ Agent}
To implement ARQ protocols a new FAPI agent is introduced in the
network stack. An illustration of this is in
Figure~\ref{network_stack}.
TransportARQ agent transmits and receives FAPI
messages form LINK layer agent. 
It also subscribes to PHY and Ranging agents for managing range and timing constraints. 
TransportARQ agent is mainly
responsible for following tasks.
\begin{itemize}

\item Calculation of block size, packet size and necessary parameters for
various protocols based on algorithms suggested in \cite{jugglenotjuggle}.
\item Segmentation and Reassembly of user file or data
\item Creation, Encoding and Decoding of Transport Packet
\item Encapsulation of Transport packet into Link layer data frame
\item Transmission and Reception of Transport packets
\item Timer management for time constraints in J-ARQ protocol 
\item Sending block ACK messages upon receiving a block of packets
or when the timer expires
\item Re-transmission of un-ACKed packets selectively
\item Switching between protocol variations
\end{itemize}

 \begin{figure}[h!]
   \includegraphics[scale=0.5]{./img/transport.png}
      \caption{TransportARQ Agent modem Network stack}
      \label{network_stack}
\end{figure}
